package com.atguigu.day05;

public class Example3 {
    public static void main(String[] args) {
        add(1.0, 1);
    }

    public static Object add(Object a, Object b) {
        if (a instanceof Integer && b instanceof Integer) {
            return (int)a + (int)b;
        } else if (a instanceof String && b instanceof String) {
            return a.toString() + b.toString();
        } else {
            throw new RuntimeException("a和b类型不匹配");
        }
    }
}
